$(function () {
    obj.init();
});

var obj = new function() {
    return {
        init: function () {
            this.listener();
        },
        listener: function () {
            var $this = this;
            $('#agree').on('click',function () {
                $this.funObj().checkAgree(1);
            });
            $('#disAgree').on('click',function () {
                $this.funObj().checkAgree(2);
            });
        },
        funObj: function () {
            var $this = this;
            return {
                checkAgree: function (_type) {
                    var msg = '';
                    if (_type === 1) {
                        msg = '确认同意？';
                    } else {
                        msg = '确认不同意？';
                    }
                    var checkMsg = $('#checkMsg').val();
                    // if (!checkMsg) {
                    //     window.top.xhTop.showError('请填写确认意见');
                    //     return false;
                    // }
                    xhExtra.askChangeStatus('res/handleCheckTypeIn', {id: id, teach: teach, type: _type, checkMsg: checkMsg}, $this.dataGrid, msg,
                        function () {
                            $('#agree').attr('disabled', true);
                            $('#disAgree').attr('disabled', true);
                        });
                }
            }
        }
    }
};
